/*
 * @author hope.chen, QQ:77132995, email:kazeik@163.com
 * 2020-09-02 17:40
 * 类说明:
 */

import 'package:shared_preferences/shared_preferences.dart';

class SharedPreUtils {
  Future<String> getString(String key) async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    return prefs.getString(key)!;
  }

  static Future<bool> saveInfo(String key, String value) async {
    SharedPreferences preferences = await SharedPreferences.getInstance();
    return preferences.setString(key, value);
  }

  static removeInfo(String key) async {
    SharedPreferences preferences = await SharedPreferences.getInstance();
    preferences.remove(key);
  }

  static Future<String?> getInfo(String key) async {
    SharedPreferences preferences = await SharedPreferences.getInstance();
    return await preferences.getString(key);
  }

  static Future<bool?> getBoolInfo(String key) async {
    SharedPreferences preferences = await SharedPreferences.getInstance();
    return await preferences.getBool(key);
  }

  static saveBoolInfo(String key, bool value) async {
    SharedPreferences preferences = await SharedPreferences.getInstance();
    preferences.setBool(key, value);
  }
}
